let app = getApp();
var util = require('../../utils/util.js');
let url = app.url;
Component({
	/**
	 * 组件的属性列表
	 */
	properties: {
		//控制模态框显示和隐藏
		showModal: {
			type: Boolean,
			value: true
		},
		groupActivityId: {
			type: null,
			value: null
		},
		groupFoundId: {
			type: null,
			value: null
		}
	},
	/**
	 * 组件的初始数据
	 */
	data: {

	},

	/**
	 * 组件的方法列表
	 */
	methods: {
		onCancel() {
			wx.showToast({
				title: '取消组团成功',
				icon: 'none'
			})
			this.setData({
				showModal: false
			})
		},
		formSubmit(e) {
			// 点击组队跳转到组队页面
			let objItem = {
				cid: wx.getStorageSync('userInfo').userInfo.id,
				groupActivityId: this.data.groupActivityId,
				groupFoundId: this.data.groupFoundId,
				formId: e.detail.formId
			}
			util(`${url}groupFound/addGroupFollow`, objItem).then(res => {
				// console.log('发送的参数', objItem);
				// console.log('响应的结果：', res, '---------------------------------------')
				this.triggerEvent('teamFlagTrue', res);
				if (res.status == 1) {
					wx.showToast({
						title: '拼团成功！'
					})
				} else {
					wx.showToast({
						title: res.msg,
						icon: "none"
					})
				}
			})

		},
	}
})
